package com.maxsalad.uc.controller;

import com.maxsalad.uc.dto.DOrderDto;
import com.maxsalad.uc.em.OrderStatus;
import com.maxsalad.uc.entity.ComboBoxItem;
import com.maxsalad.uc.pojo.ResponseResult;
import com.maxsalad.uc.pojo.TPlatformEntity;
import org.apache.commons.collections4.MapUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by 2014-400 on 2016-03-17.
 */
@RequestMapping(value = "/code")
@RestController
public class CodeController extends BaseController {
    private static final Logger log = LoggerFactory.getLogger(CodeController.class);

    @RequestMapping(value = "/orderStatus", method = RequestMethod.GET)
    public ResponseResult queryOrderStatus() {
        try {
            List<ComboBoxItem> list = new ArrayList<ComboBoxItem>();

            ComboBoxItem item;
            for (OrderStatus status : OrderStatus.values()) {
                item = new ComboBoxItem();
                item.setId(String.valueOf(status.toString()));
                item.setText(status.toCnString());
                list.add(item);
            }

            return getSucResultData(list);
        } catch (Exception e) {
            e.printStackTrace();
            log.error(e.getMessage());
        }

        return getFaultMessage();
    }
}
